package com.atguigu.srb.core.controller.admin;


import com.atguigu.common.result.R;
import com.atguigu.srb.core.pojo.entity.UserLoginRecord;
import com.atguigu.srb.core.service.UserLoginRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 用户登录记录表 前端控制器
 * </p>
 *
 * @author 熊磊
 * @since 2022-01-24
 */
@Api(tags = "会员日志登录接口")
@RestController
@RequestMapping("/admin/core/userLoginRecord")
@Slf4j
//@CrossOrigin
public class AdminUserLoginRecordController {
    @Resource
    private UserLoginRecordService userLoginRecordService;

    @ApiOperation("获取会员登录列表近50条数据")
    @GetMapping("listTop50/{userId}")
    public R listTop50(@ApiParam(value = "用户id",required = true)@PathVariable("userId")Long userId){
        List<UserLoginRecord> list = userLoginRecordService.listTop50(userId);  //我有一个想法，像这种简单查询我们可以传递封装一个需要QueryWrapper参数的函数
        return R.ok().data("list",list);
    }
}

